import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';

import 'package:flutterapp/routes.dart';
import 'package:flutterapp/scoped_model/auth.dart';
import 'package:flutterapp/scoped_model/city.dart';
import 'package:flutterapp/scoped_model/room_filter.dart';
import 'package:scoped_model/scoped_model.dart';

//这里可以做navagaion
class Application extends StatelessWidget {
  const Application({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    FluroRouter router = FluroRouter();
    Routes.configureRoutes(router);
    //配置状态管理 flutterBarModel
    return ScopedModel<AuthModel>(
        model: AuthModel(),
        //配置城市model
        child: ScopedModel<CityModel>(
          model: CityModel(),
          child: ScopedModel<FilterBarModel>(
            model: FilterBarModel(),
            child: MaterialApp(
              //设置全局主题颜色
              theme: ThemeData(primaryColor: Colors.green),
              onGenerateRoute: router.generator,
              //初始页面
              initialRoute: Routes.loading,
            ),
          ),
        ));
    //return MyApp();
  }
}
